Repository navigation
[Overview] feat(Tensors): a tensor library on general index types, with the Pauli matrices as a test - #2014
[Overview] feat(Tensors): a tensor library on general index types, with the Pauli matrices as a test#2014pariandrea wants to merge 244 commits into
Conversation
…involutive by rfl Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…hrough a pairing, with pairingToLinearMap_apply and lTensor_pairingToLinearMap_apply Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…t and pairingToLinearMap_contr_injective, its tensors, group action, map_smul_of_pure, tensorBasis and contr_tmul_eq_sum_basis Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…smul and tensorBasis_repr_reindex Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…quiv with twoSlotEquiv_map_rep, deltaTensor and their components Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…uiv_contr, contr_matMul and tensorBasis_repr_contr Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…rmTensor, with toDualAt_toDualAt, formTensor_invariant, contr_formTensor_formTensor and toDualAt_eq_contr_formTensor Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… with conj_conj, conj_smul and conj_contr Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
|
Thank you for this pull-request (PR). If this is your first PR, welcome to the community! While you wait for a review, note that you can review PRs too; reviewing is not restricted to maintainers. Our review guidelines explain what to look for. Over time, contributions such as reviews, maintenance and documentation are recorded on contributions.physlib.io. Three main points:
|
eede431 to
ac66505
Compare
…per product chain, ↓μ and ↑μ by toDualAt Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…r_basis, tensorBasis_repr_formTensor and the scoped notation ℝT[d, up, down] Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
ac66505 to
bedd51b
Compare
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…sorial, the structural laws, tensor_regroup); realLorentz on it Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…ar map (snake, toLin_tmul, toLin_map, basis_repr_toLin); invariant_of_contr, invariant_of_up; Module.Basis.lTensor_pairingToLinearMap_coevaluation; cast_apply_congr Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…_eq_of_samePair without its second hypothesis (ColorEquiv.exists_samePair_left); tmulEquiv_contr_left with ColorEquiv.tmulRight and tmulLeft; tensorBasis_repr_contr_one_pair and two_pairs; contr_congr and contr_reindex_pairs removed; mapAt, mapAt_pure, congrAt_eq_mapAt, toLin_lTensor Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…l, toDualAt_eq_mapAt, toDualAt_eq_contr from contr_matMulAt; formBilin with isSymm_formBilin, isAlt_formBilin and formMatrix_eq_toMatrix; schouten; formTensor_symm and formTensor_antisymm as reindex σ g = ±g; toDualAt_comm, congrAt_comm, toDualAt_twoSlotEquiv and toDualAt_eq_contr_formTensor removed Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…lots for chains of lowerings and raisings Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…twiningMap; tensorRep, equivOfPure, intertwiningMapOfPure, congrSlots, equiv_smul, intertwiningMap_smul, cast_apply; ForMathlib Representation.Equiv.tensorCongr and IntertwiningMap.map_invariant; toDual_rep, congrAt_smul, toDualAt_smul, reindex_smul, oneSlotEquiv_rep, twoSlotEquiv_map_rep and contr_smul removed Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…or.metricVal_invariant, coordPairing_complexVector_coVector, dotProduct_SL2CRep Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… on either side; tensor_regroup reads equations through metadata Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…rs; ForMathlib LinearMap.comp_eq_id_comm_of_finrank_eq Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…xt_pure; remove tensorBasis_repr_smul_tensorBasis, smul_tensorBasis_eq_sum Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…pSlots_id_apply; congrAt from mapAt; remove congrAt_pure mapAt is mapSlots of slotMapsAt, and congrAt is the equivalence of representations whose linear map is mapAt, so congrAt_eq_mapAt and congrAt_symm hold by rfl. mapSlots_id is now an equality of maps. toDualAt_pure uses mapAt_pure, and tensor_slots uses the slotMapsAt lemmas. Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…verview Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… index (D.3) in the Tensor overview Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…c and docstrings Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…nsorReindex and IsIntertwiningMap.piTensorMap to piTprodCongr, piTprodReindex and piTprodMap Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…ection descriptions and subsections C.1 to C.4 Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…s, without the list of additions Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…e square, in the Representation overview and section A Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…an intertwining map, in section A of Representation Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… and the tensor example with Lorentz tensors Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…_piTprod_of_tprod next to piTprod Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…ned by Lorentz examples in Representation Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…hat do not commute in C.2 of Representation Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…mily of representations is explained, in the Representation overview Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…rom its matrix Λ, in the Representation overview Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… products η Λ = (Λ⁻¹)ᵀ η, and ∘ is explained, in the Representation overview Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…lains tensorCongr by lowering both indices Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…ρ g v and g • v and why map_smul_ofDistribMulAction restates intertwining with the notation Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…p_smul and equiv_smul use Mathlib's IntertwiningMap.isIntertwining Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…s with Lorentz examples, and sections A-D are described Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… Kronecker product of one matrix per index Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…mpty, and a tensor with no indices is a scalar Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…κ ⊕ (J ⊕ J) of contrPairs, with the T^μ_μρ example Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
… ⊕ (J ⊕ J), with the Ricci tensor and Ricci scalar examples Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…kes only the standard arrangement and the dimension needs a well-defined rank Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…ection B of Representation Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
…on (Λ⁻¹)ᵀα, smul_pure docstring, tensorCongr in key results Co-authored-by: Claude Opus 5.5 <no-reply+claude-opus-5-5@anthropic.com>
This draft follows the discussion in #1950. It adds a tensor library in
Physlib/Mathematics/Tensors/next to the existing one inPhyslib/Relativity/Tensors/, and proves the Pauli matrix identities on it inPhyslib/Relativity/Bispinors/Pauli/Tensor.lean. The existingPauli/Relations.leanis untouched, so the two can be compared side by side. No existing declaration is removed or changed.This code was written with AI assistance, specifically Claude and ChatGPT.
This draft is not for merging. It shows the whole library and the Pauli example in one place. It is reviewed and merged as the stack below, in the order of the imports. Each piece builds on master and the pieces before it, and together the pieces are exactly this branch.
Stack
Color,Species,Species.contr: feat(Tensors): Color, Species and Species.contr #2049Tensor,Species.pure,Representation.piTprod: feat(Tensors): Tensor, Species.pure and the group action Species.tensorRep #2084ColorEquiv,Species.reindex,Species.tmulEquivTensorialTensor.contrSpecies.toLin,Species.delta,Species.HasForm,Species.toDualAtSpecies.inverseSpecies.HasConjugation,Species.sesqForm{…}ᵀtensor_components,tensor_regroup,tensor_indicesrealLorentzcomplexLorentzcomplexLorentz.pauliTensorMotivation
The existing tensor layer numbers indices with
Fin nand gets the dual of a color from a functionτwhose involutionτ (τ c) = cholds only up to a proof. Both choices cost casts and index arithmetic in almost every statement about products and contractions, which makes tensor proofs long and fragile.The Pauli matrices, which #1950 proposed as a test, serve as the example of the machinery. In
Pauli/Tensor.leaneach identity is a rewrite with an earlier identity followed bytensor_regroup, wherePauli/Relations.leanevaluates components.Main changes against the existing layer
c.dual.dual = cholds byrfl.k = ℝorℂ(RCLike k), a representation and a basis, with one condition. The contraction is not a field. It multiplies the components in the bases of a color and its dual, so the bases are dual by definition, and the condition is that this contraction is invariant. The contraction is a perfect pairing in Mathlib's sense, and the space of the dual color is Mathlib's dual representation.dualTensorHomEquivOfBasis, and it is invariant exactly when its linear map commutes with the group action (isIntertwiningMap_toLin_iff).Fin n. A product lives onι₁ ⊕ ι₂, and a contraction puts the remaining indices on a type chosen by the reindexing.Tensor.contr σcontracts any set of pairs at once. Two contractions in sequence are one (contr_contr), contraction commutes with products (tmulEquiv_contr_left,tmulEquiv_contr_right), and two contractions of the same pairs are equal in any order (contr_eq_of_samePair).Representation.piTprod, the representation on the tensor product of a family of representations, which Mathlib has only for two factors. Mathlib's maps ofPiTensorProduct(map,reindex,tmulEquivDep,subsingletonEquiv) and the newcontrPairsare proved to commute with it.Representation.EquivandIntertwiningMap. The invariance of a tensor built from invariant pieces follows from composition (IntertwiningMap.map_invariant).ext_pure, anextlemma) rather than induction.V c ⊗ V cthat is invariant and has an inverse. Symmetry and antisymmetry are stated on the tensor, and Mathlib's bilinear form propertiesIsSymmandIsAltare lemmas (isSymm_formBilin,isAlt_formBilin). Lowering is one linear equivalencetoDual, andtoDualAtlowers at one index. The Schouten identity is proved once for any form on a kind with two labels.Basis.piTensorProduct,(S.tensorBasis c).repr T.↓μand↑μlower and raise. Three tactics work on it.tensor_componentsreduces an equation to components.tensor_regroupproves an equation of sums of contractions of the same factors, however they are grouped or ordered, inserting deltas, cancelling a form against its inverse and swapping symmetric or antisymmetric forms where needed.tensor_regroup using e₁, …first rewrites with known identities.tensor_indicesproves equations of chains of lowerings and raisings.Lorentz.Vector dand the Weyl spinors enter the notation through the classTensorial.The Pauli matrices
The Pauli matrices are the invariant tensor
pauliTensor : ℂT[up, upL, upR]. No proof inPauli/Tensor.leansplits into cases over components. The components ofσcome fromComplexVector.pauliVal, and lowering both Weyl indices gives the adjugate matrix,σ̄^μ = adj σ^μ(adjugate_pauliMatrix). The trace identitytr(σ̄_μ σ_ν) = 2 η_μνcomes from the existing matrix lemmatrace_pauliMatrix_mul_pauliMatrix. Contracting withσgives mapsvectorToBispinorandbispinorToVectorbetween tensors with a vector index and tensors with two Weyl indices.bispinorToVector ∘ vectorToBispinor = 2is the trace identity, and since both spaces have dimension 16,vectorToBispinor ∘ bispinorToVector = 2as well, which is the Fierz identity. The two anticommutators follow from the traces and the Schouten identity ofε.Each piece of the stack lists its declarations and has its own reviewer map.